package com.quanhenghe.conf;

import com.quanhenghe.info.StationInfo;

public class GetSql {
	
	StationInfo staInfo = new StationInfo();
	GetFirInsert sta = new GetFirInsert();
	String nameStr = staInfo.getNameStr();
	String UrlStr = staInfo.getUrlStr();

	public String[] getInsSql() {
		nameStr = nameStr.replaceAll("\r", "");
		UrlStr = UrlStr.replaceAll("\r", "");
		String[] names = nameStr.split("[\n]");
		String[] urls = UrlStr.split("[\n]");
		// 分割字符串
		String insr = sta.getSQLstr();
		String[] insrbak = insr.split("[']");
		// System.out.println(insr);
		// System.out.println();
		int nameIndex = 3, urlIndex = 5;
		int idx = 0;
		StringBuilder sb = new StringBuilder();
		
		for (int t = 0; t < names.length; t++) {
			for (int i = 0; i < insrbak.length; i++) {
				if (i == nameIndex) {
					sb.append(names[t]);
				}
				if (i == urlIndex) {
					sb.append(urls[t]);
				}
				if (i != nameIndex && i != urlIndex) {
					sb.append(insrbak[i]);
				}
				if (i != (insrbak.length - 1)) {
					sb.append("'");
				}
			}
//			sb.append("\n");
		}
//		System.out.println(sb);
		return sb.toString().split("[\n]");
	}
}
